<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="root">
    <div v-for="item in goodsList" :key="item.id">
        <h3>{{item.goodsName}}</h3>
        <p>价格：{{item.goodsPrice | currency("$",3)}}</p>
        <p>上架时间：{{item.addTime | date}}</p>
        <hr/>
    </div>
</div>
<hr/>
<div id="app">
    <div v-for="item in goodsList" :key="item.id">
        <h3>{{item.goodsName}}</h3>
        <p>价格：{{item.goodsPrice | currency("$",3)}}</p>
        <p>上架时间：{{item.addTime | date}}</p>
        <hr/>
    </div>
</div>
</body>
<script type="module">
    import  vueFilters from "./lib/vueFilters.js"
	// 第一个参数是过滤器的名字，第二个参数是一个函数
    for(let key in vueFilters){
		Vue.filter(key,vueFilters[key])
    }
	new Vue({
		el: "#root",
		data: {
			goodsList: [
				{
					id: 1,
					goodsName: "梨",
					goodsPrice: 34.567,
					addTime: Date.now() - 999999999999
				},
				{
					id: 2,
					goodsName: "桃子",
					goodsPrice: 78.99899,
					addTime: Date.now() - 88888888888
				}
			]
		}
	})
	new Vue({
		el: "#app",
		data: {
			goodsList: [
				{
					id: 1,
					goodsName: "梨",
					goodsPrice: 34.567,
					addTime: Date.now() - 999999999999
				},
				{
					id: 2,
					goodsName: "桃子",
					goodsPrice: 78.99899,
					addTime: Date.now() - 88888888888
				}
			]
		}
	})
</script>
</html>